package com.cjst.controller.api.runway;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cjst.controller.base.BaseController;
import com.cjst.lot.runway.RunWayOperation;
import com.cjst.util.common.ResultCode;
import com.cjst.util.json.ResultObj;

@Controller
@RequestMapping("/api/ruanway")
public class RunWayController  extends BaseController{
	@Autowired
	private RunWayOperation runWayOperation;
	@RequestMapping(value = "/returnResult", method = RequestMethod.POST)
	@ResponseBody
	public Object returnResult(String equipmentid,String start,String end,Integer type){
		try{
			ResultObj obj = new ResultObj(ResultCode.RESULT_SUCCESS, "success", runWayOperation.returnResult(equipmentid, start, end, type));
			return obj.toString();
		}catch(Exception e){
			ResultObj obj = new ResultObj(ResultCode.RESULT_EXCEPTION, "网络异常");
			return obj.toString();
		}
	}
	@RequestMapping(value = "/userDate", method = RequestMethod.POST)
	@ResponseBody
	public Object userDate(Integer uid,String phone,String equipmentid,String parkId,String imageId,Integer pageNum,Integer pageSize,Integer type){
		try{
			if(pageNum==null){
				pageNum=1;
			}
			if(pageSize==null){
				pageSize=1000;
			}
			ResultObj obj = new ResultObj(ResultCode.RESULT_SUCCESS, "success", runWayOperation.userDate(uid, phone, equipmentid, parkId,imageId,pageNum,pageSize,type));
			return obj.toString();
		}catch(Exception e){
			ResultObj obj = new ResultObj(ResultCode.RESULT_EXCEPTION, "网络异常");
			return obj.toString();
		}
		
	}
}
